<template>
  <view class="news-container">
    <CustomTextView 
      v-for="(item, index) in newsList" 
      :key="index"
      :title="item.title" 
      :isTop="item.isTop" 
      :author="item.author" 
      :comments="item.comments" 
      :time="item.time" 
      :tags="item.tags"
    ></CustomTextView>
  </view>
</template>

<script>
import CustomTextView from "../../components11/cardText.vue"; // 确保路径正确

export default {
  components: {
    CustomTextView
  },
  data() {
    return {
      newsList: [
        {
          title: "党的二十届四中全会闭幕，释放多项民生利好政策",
          isTop: true,
          author: "新华社",
          comments: 1256,
          time: "2025.10.26",
          tags: []
        },
        {
          title: "我国新一代载人飞船试验船返回舱成功着陆，突破多项关键技术",
          isTop: false,
          author: "中国航天报",
          comments: 987,
          time: "2025.10.25",
          tags: []
        },
        {
          title: "全国范围内开展中小学课后服务质量提升专项行动，覆盖超95%学校",
          isTop: true,
          author: "教育部官网",
          comments: 3241,
          time: "2025.10.24",
          tags: []
        },
        {
          title: "全球首个陆上商用小型模块化反应堆并网发电，年发电量可达12亿度",
          isTop: false,
          author: "科技日报",
          comments: 654,
          time: "2025.10.24",
          tags: ["清洁能源", "科技突破"]
        },
        {
          title: "《国家乡村振兴战略规划（2025-2030年）》发布，明确五大重点任务",
          isTop: false,
          author: "农业农村部",
          comments: 872,
          time: "2025.10.23",
          tags: ["乡村振兴", "政策解读"]
        }
      ]
    };
  }
};
</script>

<style>
.news-container {
  padding: 16rpx 0;
  background-color: #f5f5f5;
  min-height: 100vh;
}

.news-container::before {
  content: "最新资讯";
  display: block;
  font-size: 36rpx;
  font-weight: 600;
  color: #333;
  padding: 0 36rpx 16rpx;
}

.news-container:empty {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
  color: #999;
  font-size: 32rpx;
}
.news-container:empty::before {
  content: "暂无新闻数据";
  padding: 0;
}
</style>